/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.wechat.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.thinkgem.jeesite.common.persistence.BaseDao;
import com.thinkgem.jeesite.common.persistence.BaseDaoImpl;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.boxin.ims.modules.wechat.entity.WechatMember;

/**
 * 微信会员DAO接口
 * @author Jakemanse
 * @version 2013-09-08
 */
public interface WechatMemberDao extends WechatMemberDaoCustom, CrudRepository<WechatMember, Long> {

	@Modifying
	@Query("update WechatMember set delFlag='" + WechatMember.DEL_FLAG_DELETE + "' where  id = ?1  ")
	public int deleteById(Long id);
	
	
	@Modifying
	@Query("delete from  WechatMember  where   user.id = ?1  and wechatId = ?2")
	public int deleteByUserIdAndWechatId(Long UserId,String wechatOpenId);
	
	@Query(" from  WechatMember  where   user.id = ?1  and wechatId = ?2")
	public WechatMember getByWechatMemberId(Long userId,String wechatId);
	
}

/**
 * DAO自定义接口
 * @author Jakemanse
 */
interface WechatMemberDaoCustom extends BaseDao<WechatMember> {

}

/**
 * DAO自定义接口实现
 * @author Jakemanse
 */
@Component
class WechatMemberDaoImpl extends BaseDaoImpl<WechatMember> implements WechatMemberDaoCustom {

}
